home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / Erics C++ Libraries / Interface Classes / CPPVisualObject.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-04  |  2.0 KB  |  85 lines  |  [TEXT/KAHL]

  1. /***************************************************** IMPLEMENTATION
  2.     DATE:    9/22/93
  3.     AUTHOR: Eric R. Rosé
  4.  
  5.     CLASS:  CPPGossipMonger
  6.     
  7.     SUPERCLASS: CPPObject
  8.     
  9.         This is an abstract C++ superclass for objects which live in
  10.         windows.
  11.     
  12. ********************************************************************/
  13.  
  14. #pragma once
  15.  
  16. #include <CPPGossipMonger.h>
  17.  
  18. #define    kSBarWidth    16
  19. #define    kPageWidth    512
  20. #define kPageHeight    768
  21.  
  22. #define kOn        1
  23. #define    kOff    0
  24. #define    kToggle    -1
  25.  
  26. #define    kNoCommand 0
  27.  
  28. class CPPWindow;
  29.  
  30. typedef void (*ClickProcPtr)(CPPWindow *ourWindow);
  31.  
  32. class CPPVisualObject : public CPPGossipMonger {
  33. public:
  34.  
  35.             CPPVisualObject (CPPWindow *itsWindow, Rect *itsBounds,
  36.                              Boolean canBeTarget = TRUE,
  37.                              Boolean active = FALSE, Boolean visible = TRUE);
  38.             ~CPPVisualObject (void);
  39.         
  40.     virtual    char    *ClassName (void);
  41.  
  42.     virtual    void    Draw (void);
  43.  
  44.     virtual    Boolean    DoCommand (short commandID);
  45.  
  46.     virtual    void    DoIdle (void);
  47.     virtual    Boolean    DoClick (EventRecord *theEvent);
  48.     virtual    Boolean    DoKey (char theKey, short modifiers, short what);
  49.     
  50.     virtual    void    MakeVisible (Boolean nowVisible);
  51.     virtual    void    Activate (Boolean nowActive);
  52.             void    Move (short newH, short newV);
  53.             void    Resize (short newWidth, short newHeight);
  54.     virtual    void    TargetHilite (Boolean makeTarget);
  55.     virtual    void    DrawHilite (void);
  56.     virtual    void    EraseHilite (void);
  57.     
  58.     virtual    Boolean    InContent(Point clickPt);
  59.     virtual    Rect    *GetBounds (void);
  60.     
  61.             void    SetCommand (short theCommand);
  62.             void    SetDoClickProc (ClickProcPtr clickProc);
  63.  
  64.             Boolean    IsVisible (void);
  65.             Boolean IsActive (void);
  66.             Boolean    CanBeMadeTarget (void);
  67.             void    Global2Local (Point *thePoint);
  68.             
  69.             Boolean    InColorWindow (void);
  70.             
  71. protected:
  72.     WindowPtr    owningWindow;
  73.     CPPWindow    *owningWObject;
  74.     Rect        bounds;
  75.     Boolean        isActive;
  76.     Boolean        isVisible;
  77.     Boolean        isTarget;
  78.     Boolean        canBeTarget;
  79.     ClickProcPtr    doClickProc;
  80.     short        commandEquivalent;
  81.     
  82.     virtual    void    MoveContent (short newH, short newV);
  83.     virtual    void    ResizeContent (short newWidth, short newHeight);
  84.  
  85. };